#include "ia041.h"

int countInts(FILE * fptr)
{
  int count = 0;
  int value;
  fseek(fptr, 0, SEEK_SET);
  while (fscanf(fptr, "%d", & value) == 1)
    {
      count ++;
    }
  return count;
}

void readInts(FILE * fptr, int * array, int length)
{
  int count = 0;
  int value;
  fseek(fptr, 0, SEEK_SET);
  while ((fscanf(fptr, "%d", & value) == 1) && (count < length))
    {
      array[count] = value;
      count ++;
    }
}


int arePositive(int * array, int size)
{
  int iter;
  for (iter = 0; iter < size; iter ++)
    {
      if (array[iter] <= 0) 
	{
	  return FALSE;
	}
    }
  return TRUE;
}

int areIncreasing(int * array, int size)
{
  int ind;
  for (ind = 0; ind < size - 1; ind ++)
    {
      if (array[ind] >= array[ind + 1])
	{
	  return FALSE;
	}
    }
  return TRUE;
}

int areDistinct(int * array, int size)
{
  int ind1, ind2;
  for (ind1 = 0; ind1 < size; ind1 ++)
    {
      for (ind2 = ind1 + 1; ind2 < size; ind1 ++)
	{
	  if (array[ind1] == array[ind2])
	    {
	      return FALSE;
	    }	  
	}
    }
  return TRUE;
}
